package com.codefish.codefishseckill.config;

import com.codefish.codefishseckill.service.MailService;
import com.codefish.codefishseckill.service.impl.MailServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;

/**
 * 配置定时任务
 *
 * @author codefish
 * @version 1.0
 * @date 2022/07/21 上午 10:30
 */
@Configuration
@Slf4j
public class TaskConfig {

    /**
     * 配置定时任务线程池
     *
     * @return 定时任务线程池
     */
    @Bean(destroyMethod = "shutdown")
    ScheduledExecutorService scheduledExecutorService() {
        return Executors.newScheduledThreadPool(5);
    }
}
